package service

import (
	"gino/app/cache"
	"gino/global"
	utils2 "gino/pkg/utils"
)

var Cron = cronService{}

type cronService struct{}

// AcquireCron 分布式cron
func (s *cronService) AcquireCron() (*utils2.RedisLock, bool) {
	redisConn := global.Redis.Get()
	// DO NOT close redis connection because we need use connection to delete cron lock cache
	//defer conn.Close()
	return cache.Cron.AcquireCronLock(redisConn)
}
